package com.webex.ta.hydra.core;

/**
 * Created by Cisco WebEx.
 * User: vegaz
 * Date: 2010-9-17
 * Time: 14:50:51
 */
public class AssertionResult {
    private TestResult parent;
    private String keyword;
    private String[] args;
    private boolean failure = false;
    private boolean error = false;
    private String message;


    public static AssertionResult createInstance(Command creator) {
        AssertionResult result = new AssertionResult();
        return result;
    }

    public TestResult getParent() {
        return parent;
    }

    public void setParent(TestResult parent) {
        this.parent = parent;
    }

    public boolean isError() {
        return error;
    }

    public void setError(boolean error) {
        this.error = error;
    }

    public boolean isFailure() {
        return failure;
    }

    public void setFailure(boolean failure) {
        this.failure = failure;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public String[] getArguments() {
        return args;
    }

    public void setArguments(String[] args) {
        this.args = args;
    }

    public String prettyFormat() {
        StringBuffer sb = new StringBuffer();
        sb.append(keyword).append("(");
        if (args != null) {
            for (int i = 0 ; i < args.length; i++) {
                sb.append(args[i]);
                if (i != args.length -1)
                    sb.append(",");
            }
        }
        sb.append(")");
        return sb.toString();
    }
}
